package com.biye.api.controller.admin;

import com.alibaba.fastjson.JSONObject;
import com.biye.api.service.ClassManageService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author Maple.Chen
 * @Description 班级管理 - handler
 * @Date 0:02 2021/4/3
 **/
@Controller
@RequestMapping(value = "/admin")
public class ClassManageController {

    @Resource
    private ClassManageService classManageService;

    // 班级新增
    @RequestMapping(value = "class", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject saveClass(@RequestBody Map<String, Object> requestMap){
        return classManageService.saveClass(requestMap);
    }

    // 班级修改
    @RequestMapping(value = "class", method = RequestMethod.PUT)
    @ResponseBody
    public JSONObject amendClass(@RequestBody Map<String, Object> requestMap){
        return classManageService.amendClass(requestMap);
    }

    // 班级删除
    @RequestMapping(value = "class", method = RequestMethod.DELETE)
    @ResponseBody
    public JSONObject delClass(@RequestBody Map<String, Object> requestMap){
        return classManageService.delClass(requestMap);
    }

    // 班级查询，下拉框专用
    @RequestMapping(value = "class_list", method = RequestMethod.GET)
    @ResponseBody
    public JSONObject queryClassForDropDownList(){
        return classManageService.queryClassForDropDownList();
    }

    // 班级查询，分页，条件查询
    @RequestMapping(value = "classQuery", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject queryClassList(@RequestBody Map<String, Object> requestMap){
        return classManageService.queryClassList(requestMap);
    }

}
